﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace BullTasDesaDal.Entities
{
    public class Land
    {
        public virtual Int64 Id { get; set; }
        public virtual Analysis Analysis { get; set; }
        public virtual LandClasification LandClasification { get; set; }
        public virtual decimal Ha { get; set; }
        public virtual int PriceHa { get; set; }
        public virtual DateTime DateCreate { get; set; }
        public virtual string UserCreate { get; set; }

        public virtual string HaString
        {
            get { return Ha.ToString(CultureInfo.InvariantCulture.NumberFormat); }
        }

        public virtual string PriceHaString
        {
            get { return PriceHa.ToString(CultureInfo.InvariantCulture.NumberFormat); }
        }

        public virtual string TotalString
        {
            get { return string.Format("{0:c}", Total); }
        }

        public virtual decimal Total
        {
            get { return (Ha * PriceHa); }
        }
        
        public override bool Equals(object obj)
        {
            if (this == obj) return true;
            Land land = obj as Land;
            if (land == null) return false;
            return Id == (land.Id + land.Analysis.Id);
        }

        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }

       
    }
}
